import { withRouter } from "next/router";
import Link from "next/link";
import { Affix } from "antd";
// css
import styles from "@/styles/CommonPersonal.module.scss";

const Aside = ({ router }) => {
  
  const { route } = router;

  const navs = [
    { name: "个人信息", url: "/personal" },
    { name: "我的订单", url: "/personal/order" },
    { name: "优惠券", url: "/personal/coupon" },
    { name: "意见反馈", url: "/personal/feedback" },
  ];

  return (
    <nav className={styles["nav"]}>
      <Affix offsetTop={10}>
        <ul>
          {navs.map((item, index) => {
            const { url } = item;
            return (
              <li key={index}>
                <Link href={url}>
                  <a className={url === route ? styles["active"] : ""}>{item.name}</a>
                </Link>
              </li>
            )
          })}
        </ul>
      </Affix>
    </nav>
  );
};

export default withRouter(Aside);